stdlib: adds itertools, composable templates for inline iterators#25680
Open
ZoomRmc wants to merge 3 commits intonim-lang:develfrom
Open
stdlib: adds itertools, composable templates for inline iterators#25680ZoomRmc wants to merge 3 commits intonim-lang:develfrom
itertools, composable templates for inline iterators#25680ZoomRmc wants to merge 3 commits intonim-lang:develfrom
Conversation
Contributor
Author
|
Test failures all should get green after #25679. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements RFC #562 , it was given a green light long ago.
The code is based on beef's idea and impl in
slicerator/itermacros.For convenient syntax that allows writing
"foo".split.mapIt(it).collect()and notmapIt("foo".split, it).collect()"it requires merging #25679 (or an alternative fix) but it doesn't rely on it inherently (except some examples and test cases assume this form being available), so workable even without it.This example works now:
The implementation is straightforward, API is bog-standard and shouldn't be surprising to anyone familiar with this style, tests cover everything. The only interesting thing in the code is that it uses concepts for overloads without any
when compileshacks, feels pretty great.The set of provided templates is basic and the naming is all common, so I hope there's not much place for bikeshedding. I've been craving for this feature since 2018 or so and didn't hear much pushback against the idea, so I hope this PR doesn't go to waste.
requires #25679